/**
* This file is part of tictionary.
*
* tictionary is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* You should have received a copy of the GNU General Public License
* along with dev.clipall.  If not, see <http://www.gnu.org/licenses/>.
*
* http://code.google.com/p/tictionary/
*/

/*
 * ImageScreen.java
 *
 * Created on October 4, 2007, 5:57 PM
 */

package tictionary;

import javax.microedition.lcdui.*;

/**
 *
 * @author  erol
 * @version
 */
public class ImageScreen extends Canvas {
    
    private Image image;
    
    /**
     * constructor
     */
    public ImageScreen(Image image) {
        
        this.image = image;
        
        setFullScreenMode(true);
    }
        
    public void paint(Graphics g) {
        
        g.setColor(18,145,60);
        g.drawRect(1,1, g.getClipWidth()-3, g.getClipHeight()-3);
        
        final int centerX = g.getClipWidth() / 2 + g.getClipX();
        final int centerY = g.getClipHeight() / 2 + g.getClipY();
        
        if (image != null) {
            g.setColor(255,255,255);
            g.fillRect(0,0,g.getClipWidth(), g.getClipHeight());
            g.drawImage(image, centerX, centerY, Graphics.HCENTER | Graphics.VCENTER);
        }
    }
        
    protected void sizeChanged(int w, int h) {
        repaint();
    }
}
